DEMO: A function is a defined block of code that has a specific task.

A function will not run until it is called. You can call a function anywhere in your code after you define it.

  • Click Run to see the parts of a function. Follow the onstage directions to complete the demo.
  • At the end of the demo, you will be asked to add a call line to the code.
  • Click Submit and Next to answer the questions about functions in the next activity.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)